#include "StdAfx.h"
#include "PlugManager.h"

CPlugManager::CPlugManager(void)
{
}

CPlugManager::~CPlugManager(void)
{
	PlugList::iterator it = m_listPlugs.begin();
	for(; it != m_listPlugs.end(); ++it)
	{
		HINSTANCE  hModule = *it;
		::FreeLibrary(hModule);
	}

	m_listPlugs.clear();
}

bool CPlugManager::LoadPlug(const CString& szPlugName)
{
	HINSTANCE  hModule = ::LoadLibrary(szPlugName);
	if(NULL == hModule)
	{
		AfxMessageBox(_T("Load Plug Error :")+szPlugName);
		return false;
	}

	m_listPlugs.push_back(hModule);

	return true;
}

bool CPlugManager::UnLoadPlug(const CString& szPlugName)
{
	return false;
}